package com.test2015.ui.flexiblecomp.item;

import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;

public class FlexibleItem {
	
	List <FlexibleItem> childs = null;
	FlexibleItem parent = null;
	
	String iconPath = null;
	String txt = null;
	String toolTip = null;
	String command = null;
	ActionListener action = null;
	
	public FlexibleItem(){
		this(null,null);
	}
	
	public FlexibleItem(String name,String command){
		this.txt = name; 
		this.command = command; 
		childs = new ArrayList<FlexibleItem>();
	}

	public List<FlexibleItem> getChilds() {
		return childs;
	}

	public void setChilds(List<FlexibleItem> childs) {
		this.childs = childs;
	}

	public FlexibleItem getParent() {
		return parent;
	}

	public void setParent(FlexibleItem parent) {
		this.parent = parent;
	}

	public String getIconPath() {
		return iconPath;
	}

	public void setIconPath(String iconPath) {
		this.iconPath = iconPath;
	}

	public String getTxt() {
		return txt;
	}

	public void setTxt(String txt) {
		this.txt = txt;
	}

	public String getToolTip() {
		return toolTip;
	}

	public void setToolTip(String toolTip) {
		this.toolTip = toolTip;
	}

	public String getCommand() {
		return command;
	}

	public void setCommand(String command) {
		this.command = command;
	}

	public ActionListener getAction() {
		return action;
	}

	public void setAction(ActionListener action) {
		this.action = action;
	}
	
	
	public void addChild(FlexibleItem item){
		childs.add(item);
		item.setParent(this);
	}
	
	public void addChild(FlexibleItem[] items){
		for(FlexibleItem i : items){
			childs.add(i);
			i.setParent(this);
		}
	}
	
}
